import {reactive} from "vue"

export const operationItem = reactive({
  defaultSearch: true,//默认搜索按钮
  defaultRefresh: true,//默认重置按钮
  customTableHeader: false,//
  SearchItem: [
    {
      code: 'name',
      name: '名称',
      type: 'input',
    },
    {
      code: 'courseType',
      name: '课程类型',
      type: 'cascader',
      props: {label: 'name', value: 'id', children: 'children', emitPath: false}
    },
    {
      code: 'type',
      name: '类型',
      type: 'select'
    },
    {
      code: 'publishedFlag',
      name: '状态',
      type: 'select',
      placeholder: '请选择状态',
      options: [
        {label: '上架', value: 1},
        {label: '下架', value: 0}
      ]
    },
  ],
  menuArray: [
    {
      show: true,
      code: 'del',
      type: 'danger',
      text: '批量删除',
    },
    {
      show: true,
      code: 'add',
      type: 'primary',
      text: '新建',
    },
    // {
    // 	show: true,
    // 	code:'import',
    // 	type: 'primary',
    // 	text: '导入',
    // },
    {
      show: true,
      code: 'export',
      type: 'primary',
      text: '导出',
    },
    {
      show: true,
      code: 'add',
      type: 'primary',
      text: '批量添加',
    },
  ]
})
export const tableItem = reactive({
  select: true,//多选框
  index: false,//顺序
  expandAll: false,//树形默认展开
  align: 'center',
  column: [
    {
      label: '名称',
      prop: 'name',
    },
    {
      label: '课程类型',
      prop: 'courseTypeName',
    },
    {
      label: '类型',
      prop: 'typeName',
    },
    {
      label: '关联建培圈内容',
      prop: 'assoBankName',
      tooltip: true,
    },
    {
      label: '状态',
      htmlContent: row => {
        return `<span>${row.publishedFlag == 1 ? '上架' : '下架'}</span>`
      },
    },
    {
      label: '创建时间',
      prop: 'createTime',
    },
    {
      label: '操作',
      prop: 'action',
      width: '200px',
    }
  ],
  pageInfo: {
    request: {
      pageDomain: {}
    },
    pagesClose: false,//是否开启分页
    url: '/admin/resource/question/bank/paging',//分页路由，不传的话需要传入自定义的分页函数paging 传入时定义的分页函数paging会失效
  },
  // 分页数据 自定义分页函数paging时需要把值赋给tableData
  tableData: {
    total: 10,//分页总计
    // 分页数据
    data: []
  },
  // 操作栏按钮
  btnArray: [
    {
      type: 'primary',//类别 摈弃了text
      code: 'detail',
      label: '详情',
    },
    {
      type: 'primary',//类别 摈弃了text
      label: '修改',
      code: 'edit',
    },
    {
      type: 'primary',//类别 摈弃了text
      label: '预览',
      code: 'preview',
    },
    {
      type: 'primary',//类别 摈弃了text
      label: '上架',
      code: 'published',
      showFunction: (row) => {
        return row.publishedFlag == 0;
      },
    },
    {
      type: 'danger',//类别 摈弃了text
      label: '下架',
      code: 'unpublished',
      showFunction: (row) => {
        return row.publishedFlag == 1;
      },
    },
  ],
  // 选择框触发
  selectChange: function (row) {
  },
})
